CONTENTS | INDEX | PREV | NEXT
strins
NAME
strins - insert one string within another
SYNOPSIS
void strins(d, s);
char *d;
const char *s;
FUNCTION
strins inserts string s into d by shifting the string in d over
strlen(s) spaces and then copying s into the newly made hold (except
for the nul, of course). This result is s inserted into d.
NOTE
There must be enough room in d to insert s. i.e. if d is an array
of 32 chars and contains a string of 8 chars you can insert another
string of, say, 10 chars, but not of 30 chars.
strins is NOT an ANSI standard function
EXAMPLE
#include <stdio.h>
#include <string.h>
main()
{
char buf[32];
strcpy(buf, "This is a test");
strins(buf + 5, "<gak!> ");
puts(buf); /* This <gak!> is a test */
return(0);
}
INPUTS
char *d; destination to insert in front of
char *s; source string to insert
RESULTS
none
SEE ALSO
strcpy, strcat, strlen